Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

nice_things/log/abort.sh

abort

Since 0.3.0 · Source

import "{ abort }" from nice_things/log/abort.sh

Synopsis
abort <message> [<status_code>]

Configuration

Description
Print a message to log_error and exit the current process with an error status code.

The optional parameter <status_code> can be used to specify the exit status. If omitted, the status of the last command will be used if it failed, otherwise the program will exit will status code 1.

Options

Operands

  • <message>: A message to print to stderr.
  • <status_code>: An optional status code to return for the current process.

Stdin

Stdout

Stderr
The <message> will be printed to log_error.

Exit status
From parameter <status_code> if provided, else the exit status of the last command if an error, else 1.

Abort
Always exits the process.

Usage examples

: >/path/to/file || abort "Failed to create file at /path/to/file"